#pragma once

#include <string>

#include <ipc_message_parcel.h>
#include <refbase.h>

class IpcClient : public RefBase {
public:
    static sptr<IpcClient> GetInstance();

    int Connect(std::string addr, uint16_t port);
    int Send(IpcMessageParcel &parcel);
    int Recv(IpcMessageParcel &reply);
    void Disconnect();

private:
    IpcClient() = default;
    virtual ~IpcClient() = default;
    static inline sptr<IpcClient> instance = nullptr;

    int socketFd = -1;
};
